/*
 This file is part of BTStracker
		
    BTStracker is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    BTStracker is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.	
	author: azbest.pro (azbest.pro@gmail.com)
*/
package pl.vdl.azbest.swt;

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;

import pl.vdl.azbest.mremote.gui.SWTElement;

public class SWTElementTabFolder extends  SWTElement{

	//private Shell sShell = null;

	private TabFolder tabFolder = null;

	/**
	 * This method initializes sShell
	 */
	protected void createSShell() {
		sShell = new Shell();
		sShell.setText("Shell");
		sShell.setSize(new Point(300, 200));
		sShell.setLayout(new GridLayout());
		createTabFolder();
	}

	/**
	 * This method initializes tabFolder
	 * 
	 */
	private void createTabFolder() {
		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;
		gridData.grabExcessHorizontalSpace = true;
		gridData.grabExcessVerticalSpace = true;
		gridData.verticalAlignment = GridData.FILL;
		tabFolder = new TabFolder(sShell, SWT.NONE);
		tabFolder.setLayoutData(gridData);
		
		init() ;

	}

	private void init() {
		TabItem t1 = new TabItem(tabFolder,SWT.NONE);
		t1.setText("Tab1");
		Composite1 c1 = new Composite1(tabFolder,SWT.NONE,sShell);
		t1.setControl(c1);
		
		TabItem t2 = new TabItem(tabFolder,SWT.NONE);
		t2.setText("Tab2");
		Composite2 c2 = new Composite2(tabFolder,SWT.NONE,sShell);
		t2.setControl(c2);
		
		TabItem t3 = new TabItem(tabFolder,SWT.NONE);
		t3.setText("Tab3");
		Composite3 c3 = new Composite3(tabFolder,SWT.NONE,sShell);
		t3.setControl(c3);
		
		tabFolder.setSelection(0);
		tabFolder.setTabList(new Composite[] {c1,c2,c3});
		//sShell.setSize(sShell.getSize().x+1, sShell.getSize().y+1);
	}
	public static void main(String[] args) {
		SWTElementTabFolder sds = new SWTElementTabFolder();
		sds.openSWTWidgetStandAlone2();
	}

}
